package controlador;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import modelo.Frases;
import modelo.FrasesDao;
import vista.JFFraseBasico;


public class ControladorJFFraseBasico implements ActionListener{
	
	private JFFraseBasico ventanaBasico;
	private Frases fraseBasico;
	
	public ControladorJFFraseBasico() {
		super();
		ventanaBasico=new JFFraseBasico();
		fraseBasico=new Frases();
		ventanaBasico.addListener(this);
		ventanaBasico.setLocationRelativeTo(null);
		ventanaBasico.setVisible(true);	
	}

@Override
public void actionPerformed(ActionEvent e) {
	FrasesDao frasesDao = new FrasesDao();
	if (e.getActionCommand().equals("Aceptar"))
	{
					this.fraseBasico.setNivel(Integer.parseInt(ventanaBasico.getLblcodigo().getText()));
					this.fraseBasico.setNombre(ventanaBasico.getTxtfrase().getText());
					frasesDao.insertarFrase(fraseBasico);
					this.ventanaBasico.Limpiar();
	}	
}

}